import request from '@/utils/request'

// 获取站点list
export function siteList(params) {
  return request({
    url: '/kmpt/sys/org/site',
    method: 'get',
    params
  })
}

// 获取用户组织机构树
export function orgAll(data) {
  return request({
    url: '/kmpt/sys/org/all',
    method: 'get',
    data
  })
}

// 路线列表
export const line = () => request({
  url: '/kmpt/biz/info/line',
  method: 'get',
})

// 获取路线list
export function lineList(data) {
  return request({
    url: '/kmpt/sys/org/line',
    method: 'get',
    data
  })
}

// 获取区域list
export function zoneList(data) {
  return request({
    url: '/kmpt/sys/org/zone',
    method: 'get',
    data
  })
}

// 获取组织机构list
export function orgdict(data) {
  return request({
    url: '/kmpt/sys/org/orgdict',
    method: 'get',
    data
  })
}

// 获取部门list
export function dept(params) {
  return request({
    url: '/kmpt/sys/org/dept',
    method: 'get',
    params
  })
}

// 获取班组list
export function orgTeam(data) {
  return request({
    url: '/kmpt/sys/org/team',
    method: 'get',
    data
  })
}

// 根据站点查询用户所在部门
export function searchDept(id) {
  return request({
    url: '/kmpt/sys/org/searchDeploymentBySite',
    method: 'get',
    params: {
      stationId: id
    }
  })
}

// 获取下辖组织机构
export function lowerLevel(id) {
  return request({
    url: '/kmpt/sys/org/search/lower/level/tree',
    method: 'get',
    params: {
      id: id
    }
  })
}

// 获取下辖组织机构集合
export function lowerLevelList(id) {
  return request({
    url: '/kmpt/sys/org/search/lower/level',
    method: 'get',
    params: {
      id: id
    }
  })
}

// 获取组织结构翻译
export const orgMap = (orgIds) => {
  // orgIds = orgIds.filter(item => item)
  return request({
    url: '/kmpt/sys/org/search/ids',
    method: 'post',
    data: orgIds
  })
}

// 获取下辖组织机构集合
export function orgSite(id) {
  return request({
    url: '/kmpt/sys/org/site/org',
    method: 'get',
    params: {
      orgId:id
    }
  })
}
